import request from '@/utils/request'

export function getList(page, limit, roomQuery) {
  return request({
    url: `/dormitory/room/list/${page}/${limit}`,
    method: 'post',
    data: roomQuery
  })
}

export function getRoom(id) {
  return request({
    url: `/dormitory/room/getRoom/${id}`,
    method: 'get'
  })
}

export function save(room) {
  return request({
    url: `/dormitory/room/save`,
    method: 'post',
    data: room
  })
}

export function studentHousing(housingVo) {
  // const data = { housingVo }
  return request({
    url: `/dormitory/housing/studentHousing`,
    method: 'post',
    data: housingVo
  })
}

export function update(room) {
  return request({
    url: `/dormitory/room/update`,
    method: 'post',
    data: room
  })
}

export function remove(id) {
  return request({
    url: `/dormitory/room/remove/${id}`,
    method: 'delete'
  })
}

export function buildingList() {
  return request({
    url: `/dormitory/building/buildingList`,
    method: 'get'
  })
}

export function floorList() {
  return request({
    url: `/dormitory/building/floorList`,
    method: 'get'
  })
}

export function floorListById(id) {
  return request({
    url: `/dormitory/building/floorListById/${id}`,
    method: 'get'
  })
}

export function uploadRoomImage(param) {
  return request({
    url: `/minio/oss/upload/room`,
    method: 'post',
    data: param
  })
}

export function removeRoomImage(param) {
  return request({
    url: `/minio/oss/remove/room`,
    method: 'delete',
    data: param
  })
}

export function getRoomImage(id) {
  return request({
    url: `/minio/oss/get/room/${id}`,
    method: 'get'
  })
}
